import promise from './promise.js'
export const BASE_URL = 'https://wx.ccsc.city/prod-api'

export const post = function(url,data,headerType=true){
	return promise(BASE_URL+url,'POST',data,headerType)
}

export const get = function(url,data){
	return promise(BASE_URL+url,'GET',data)
}

export const deleteRequest = function(url,data,headerType=true){
	return promise(BASE_URL+url,'DELETE',data,headerType=true)
}

export const uploadFile=function(path){
	return new Promise((resolve,reject)=>{
		uni.uploadFile({
			url: BASE_URL+'/app/bus/uploadFile', //仅为示例，非真实的接口地址
			filePath: path,
			name: 'file',
			formData: {
				
			},
			header: {
						'Authorization': 'Bearer '+ uni.getStorageSync('token')
					},
			success: (res) => {
				resolve(res.data)
			},
			fail: () => {
				uni.showToast({
					title: '请检查网络',
					duration:2000,
					icon:'none'
				});
				resolve({code:500})
			}
		});
	})
}